package com.syni.mdd.yhd.common.all.controller.protect.weChat;

/**
 * @className BmsUserCouponController
 * @description TOO
 * @Author hwq
 * @DATE 2019/10/17 10:31
 * @VERSION 1.0
 **/

import com.syni.mdd.sjb.common.component.utils.common.annotations.EntranceCheck;
import com.syni.mdd.yhd.common.all.dto.requestDto.BaseReDto;
import com.syni.mdd.yhd.common.all.service.weChat.BmsUserCouponService;
import com.syni.mdd.sjb.common.component.utils.common.utils.ParamsMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/userCoupon")
public class BmsUserCouponController {

    @Autowired
    BmsUserCouponService bmsUserCouponService;

    /**
     * @Description 用户劵列表
     * @Param showUserCoupon
     */
    @PostMapping("/showUserCoupon")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> showUserCouponLit(@RequestBody BaseReDto baseReDto){
        return bmsUserCouponService.showUserCouponList(baseReDto);
    }

    /**
     * @Description 用户劵详情
     * @Param userCouponDetail
     */
    @PostMapping("/userCouponDetail")
    public Map<String,Object> userCouponDetail(@RequestBody ParamsMap paramsMap){
        Integer couponId = paramsMap.getInteger("couponId");
        String openId = paramsMap.getString("openId");
        String myOpenId = paramsMap.getString("myOpenId");
        return bmsUserCouponService.userCouponDetail(couponId,openId,myOpenId);
    }


}
